<?php

/**
 * @author Alex McArrow
 * @copyright 2008
 */

///// function logic_check

function logic_check($log)
{
	global $DEBUGDATA;
	
	if ($log[0] == ""){$log[0] = "0";}
	if ($log[2] == ""){$log[2] = "0";}
		
	
	$result = "false";
	
	switch ($log[1]) {
case "=":
    if ($log[0] == $log[2]) {$result = "true";}
    break;
case ">":
    if ($log[0] > $log[2]) {$result = "true";}
    break;
case "<":
    if ($log[0] < $log[2]) {$result = "true";}
    break;
case ">=":
    if ($log[0] >= $log[2]) {$result = "true";}
    break;
case "<=":
    if ($log[0] <= $log[2]) {$result = "true";}
    break;
case "<>":
    if ($log[0] != $log[2]) {$result = "true";}
    break;
case "!=":
    if ($log[0] != $log[2]) {$result = "true";}
    break;
default:
    $result = "error";
}
	

//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
$DEBUGDATA[]="Logic_check(log)";
$DEBUGDATA[]="log1: ".$log[0];
$DEBUGDATA[]="log2: ".$log[1];
$DEBUGDATA[]="log3: ".$log[2];
$DEBUGDATA[]="result: ".$result;
$DEBUGDATA[]="-------------------------------------------------------";
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//	
	
	
	return $result;
}

///// function logic_check


function read_querys()
{
	global $BIGDATAARRAY;
	global $dir;
	global $DEBUGDATA;
	
	
	$handle=opendir($dir);

while ($file = readdir($handle)) 
{
if ($file == "." || $file == ".." || $file[0] == ".") 
{	
}
else
{ 


		$filedata=explode("<next>",file_get_contents($dir.$file));

		$BIGDATAARRAY[$count]=array(
									"name"=>trim($filedata[0]),
									"formin"=>trim($filedata[1]),
									"query"=>trim($filedata[2]),
									"return"=>trim($filedata[3]),
									"returntype"=>trim($filedata[4]),
									"formout"=>trim($filedata[5])
									);


		$count++;
}
}
closedir($handle);      


//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
$DEBUGDATA[]="Load querys";
$DEBUGDATA[]="count: ".$count;
$DEBUGDATA[]="-------------------------------------------------------";
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
	
	
}

?>